﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using Enterprise.Infrastructure;
using Enterprise.Model.Note;
using Enterprise.Service.Note;
using Enterprise.Control;
namespace Enterprise.UI.Web.Modules.Notice
{
    public partial class Detail : System.Web.UI.Page
    {
        int Id = (int)Utility.sink("Id", Utility.MethodType.Get, 0, 0, Utility.DataType.Int);
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                OnStart();
            }
        }

        private void OnStart()
        {
            OnBindData();
            CreateBT.AddButton("edit.gif", "修改备忘", "Manage.aspx?Id=" + Id + "&Cmd=Edit", Utility.PopedomType.Edit, HeadMenu1);
            CreateBT.AddButton("delete.gif", "删除备忘", "Manage.aspx?Id=" + Id + "&Cmd=Delete", Utility.PopedomType.Delete, HeadMenu1);
            CreateBT.AddButton("back.gif", "返回", "Index.aspx", Utility.PopedomType.List, HeadMenu1);
        }

        private void OnBindData()
        {
            NoteService nService = new NoteService();
            var q = nService.NoteDisp(Id);
            if (q != null)
            {
                lb_Title.Text = q.NTITLE;
                lb_Content.Text = q.NREMARK;
                lb_Remind.Text = (q.NISREMIND == 1 ? "提醒" : "不提醒");
                lb_RemindTime.Text = (q.NISREMIND == 1 ? q.NREMINDTIME.ToShortDateString() : "");
            }
        }

    }
}